/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ui.graphic;

import Modelos.ModeloTabuleiro;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.util.Observable;
import java.util.Observer;
import javax.swing.BoxLayout;
import javax.swing.JPanel;

/**
 *
 * @author Abyssus
 */
public class Pontuacao extends JPanel implements Observer {

    ModeloTabuleiro mT;
    String winner;
    StringBuilder finalPoints;

    public Pontuacao(ModeloTabuleiro mT) {
        this.mT = mT;
        setLayout(new FlowLayout(FlowLayout.CENTER));
        setVisible(true);
        mT.addObserver(this);
        winner= mT.endGame();
        finalPoints = mT.scoreToString();
    }

    @Override
    public void update(Observable o, Object arg) {
        repaint();
    }

    @Override
    public void paintComponent(Graphics g) {
        super.paintComponent(g);
         Graphics2D g2d = (Graphics2D) g;
        g2d.setFont(new Font("MontereyMediumFLF", Font.PLAIN, 20));
        g2d.drawString(winner, 10, 60);
        g2d.drawString(finalPoints.toString(), 50, 160);
    }

}
